package com.yj.cloudnote.service.Impl;

import com.yj.cloudnote.dao.PadMapper;
import com.yj.cloudnote.model.Pad;
import com.yj.cloudnote.service.PadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PadServiceImpl implements PadService {
    @Autowired
    private PadMapper padMapper;

    @Override
    public boolean insertNewPad(Pad pad) {
        int res = padMapper.insertSelective(pad);
        if (res > 0) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public List<Pad> selectByUsername(String username) {
        return padMapper.selectByUsername(username);
    }

    @Override
    public void deleteById(int padid) {
        padMapper.deleteByPrimaryKey(padid);
    }
}
